package emulator.GUI.keyboard;

import java.util.HashMap;

import emulator.hardware.io.peripherals.Button;

public class VicKeyboard {
	private VicKeyboardRow [] key_rows;
	private HashMap<String, VicKey> key_map;
	
	public VicKeyboard(int rows)
	{
		key_rows = new VicKeyboardRow [rows];
		for (int i = 0; i < rows; i++)
			key_rows[i] = new VicKeyboardRow();
		key_map = new HashMap<String, VicKey>();
	}
	
	public void addKey(int row, String id, VicKey key)
	{
		key_rows[row].addKey(key);
		if (id != null)
			key_map.put(id, key);
	}

	public int getRows() {
		return key_rows.length;
	}

	public int getCols(int row) {
		return key_rows[row].getCount();
	}

	public VicKey getKey(int row, int col) {
		return key_rows[row].getKey(col);
	}

	public Button getKey(String key_name) {
		return key_map.get(key_name); 
	}
}
